/*
 * @Author: Y先森
 * @Date: 2023-04-11 15:59:37
 * @LastEditors: y && 250048395@qq.com
 * @LastEditTime: 2023-05-04 14:05:56
 * @FilePath: \y-website\src\store\index.js
 */
import { createStore } from 'vuex'
import theme from './modules/theme'
import search from './modules/search'
import user from './modules/user'
import category from './modules/category'
import app from './modules/app'
import getters from './getters'
import createPersistedState from 'vuex-persistedstate'

const store = createStore({
  getters,
  modules: {
    theme,
    category,
    search,
    user,
    app,
  },
  plugins: [
    createPersistedState({
      // 保存到 localStorage 中的 key
      key: 'zhouStar',
      // 需要保存的模块
      paths: ['theme', 'search', 'user', 'app']
    })
  ]
})

export default store